<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>download</title>

<script type="text/javascript" src="${webServer}/resource/js/jquery.min.js"></script>
</head>
<body>
  	<!-- 第一种下载方式，直接文件在项目中的路径 -->
    <div style="border: 1px solid beige;">
    	<c:forEach items="${listFile}" var="file">
    		<span>${file.type}----</span><a href="javascript:void(0);">${file.name}</a>
    		<span>-----</span><a href="${file.path}">下载</a>
    		<br />
    	</c:forEach>
	</div>
	<a href="${webServer}/resource/file.doc">导入模板下载</a>
	<h1>-------------------------------------------------------------------------------</h1>
	<hr />
	<!-- 第二种下载方式，经过后台处理进行下载 -->
	 <div style="border: 1px solid beige;">
    	<c:forEach items="${listFile}" var="file" varStatus="status">
    		<span>${file.type}----</span><a href="javascript:void(0);">${file.name}</a>
    		<span>-----</span>
    		<button class="downloadbutton" data-name="${file.name}">下载</button>
    		<br />
    	</c:forEach>
    	<span>file----</span><a href="javascript:void(0);">test_file.txt</a>
    		<span>-----</span>
    		<button class="downloadbutton" data-name="test_file.txt">下载</button>
    	<form name="downloadform" action="downloadFile" method="post">
    		<input type="hidden" name="fileName" />
    	</form>
	</div>
	
	<script>
		$(".downloadbutton").click(function(){
			$("input[name='fileName']").val($(this).data("name"));
			$('form').submit();
		});
	</script>
	
</body>
</html>